Section 37. If the commonwealth has the right under stipulations in a deed given in its name to enter upon premises and, at the expense of the party at fault, to remove or alter a building, any of its grantees under similar deeds, their heirs, legal representatives or assigns may institute proceedings in equity to compel the department to enforce such stipulations.