That would create a conflict of duty and interest, and should be avoided. There may be some very narrow exceptions - such as a very small bequest, or maybe a professional role in which they can be remunerated - but anything substantial probably should mean the solicitor needs to decline making the will.