It is legal and not uncommon. Obviously, there are cases where there may be a conflict of interst that could later result in a challenge to the will--such as if the will leaves the attorney everything--but that's judged on a case-by-case basis, if there is a challenge. There is no blanket prohibition against this.