Varies by country. Germany normally forbids changes except by marriage/divorce (I think), while the UK doesn’t really have legal names, just lots of databases run by people who want an official-looking document before they update anything (and even then my university will just refuse to reprint degree certificates with a new name).