Be Careful How You Name SQL Server Stored Procedures

Be Careful How You Name SQL Server Stored Procedures

When creating stored procedures in a database other then the Master database, avoid using the ‘sp_’ prefix. System stored procedures are the only ones that should use the ‘sp_’ prefix. The issue is not that naming a procedure in this manner causes errors executing the procedure, but rather it slows down execution. When a procedure is named ‘sp_’, SQL server first looks in the Master database to resolve where the procedure is located. If it is not in the Master database, execution time is wasted attempting to look it up. SQL Server then looks up the stored procedure name as if the object owner is ‘dbo’. If the procedure is in the current working database, then it is executed.


About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist