Use the Rebuild master (rebuildm) utility to change the character set, sort order, or Unicode collation for a Microsoft SQL Server installation, or to fix a corrupted master database. Before running the Rebuild master utility, make sure you have either:
Or
Rebuilding the master database removes all database objects and data. After rebuilding the master database, re-create the database objects and reload the data, or reattach the data and log files using sp_attachdb.
rebuildm
How to rebuild the master database