====== Creating system stored procedures ======
[[https://docs.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/system-stored-procedures-transact-sql|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 ''master'' database's ''dbo'' schema, with a name beginning with ''sp_''... (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'
{{tag> tsql admin development}}