Creating system stored procedures
System stored procedures (along with other types of system object) appear logically in the sys schema of all other databases.
To make a user-defined SP available in this way:
Create the SP in the
masterdatabase'sdboschema, with a name beginning withsp_… (e.g.sp_MySystemSp).Grant access to it for all users:
GRANT EXEC ON sp_MySystemSp TO public
Mark it as a system stored procedure:
EXEC sys.sp_MS_marksystemobject 'sp_MySystemSp'