For the purposes of this section, the term "Internal Revenue Code" shall mean section 401(a), section 401(f), section 403(b)(7), section 408(a) or section 408(h) of the Internal Revenue Code.
Any designation of a beneficiary in connection with and as provided by an instrument intended to establish a pension, profit-sharing or other deferred compensation or retirement plan, trust or custodial account described in the Internal Revenue Code, and in effect from time to time, shall be effective according to its terms, notwithstanding any purported testamentary disposition allowed by statute, by operation of law or otherwise to the contrary. Nothing in this section shall limit, by implication or otherwise, any nonstatutory right of an employee to designate 1 or more beneficiaries of the employee's interest under any retirement plan not described in this section or under any other employee benefit plan.
Mass. Gen. Laws ch. 167D, § 15