Msg 2812, Level 16, State 62, Line 1 Could not find stored procedure ”

This error message occurs when SQL server interprets the text you have given as a stored procedure and cannot find a procedure with that name.

Possible reasons:

Syntax error in sql code, Mistyped SQL Code
Stored procedure does not exist
Stored procedure got deleted
Missing schema name of the procedure in the query
Using exec with dynamic sql
Using Unicode with osql
Using extended stored procedures like xp_cmdshell on azure environment.

In Detail:
– Mistyped SQL Code

When you try to execute the above code you get the error
Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure ‘abcd’.

– SQL Server interprets the single word that is sent as a query as the name of stored procedure with no parameters.

Create a stored procedure named abcd

Now try to execute the below query:

The result would be the output of executing the procedure abcd.

So in order to avoid the above error, when querying sql server using a single word then make sure that the procedure with that name exists.

– You might expect the stored procedure with the name to exist but it isn’t.

To check if the procedure exists you can use the below query:

replace PROCEDURENAME with the name of the procedure.

– There could be a missing schema name of the procedure in the query

procedures with schema names would be like dbo.sp_abcd , products.sp_createproduct etc.

To find the schema name of the stored procedure you can use the following query:

[sql]select SCHEMA_NAME(schema_id),* from sys.procedures[/sql]

You can also alternatively use the below query:

– This error could also be due to using exec with dynamic sql.

Try opening and closing the braces after exec to avoid such error, also you can use sp_executesql.


exec (@dynamicsql)
exec sp_executesql @dynamicsql


– when using unicode with osql

osql ignores Unicode files, you need to use -u switch with the osql command.

– Using SQL Azure and extended stored procedures
you could be using azure environment and SQL Azure does not have the extended stored procedures like xp_cmdshell.

Good coding standard would be to add exec statement beofore the name of the stored procedure.

2 thoughts on “Msg 2812, Level 16, State 62, Line 1 Could not find stored procedure ”

  1. whenever i execute any stored procedure , it just display the message ‘ could not find the stored procedure (name)’….. i am displaying here a simple query of stored procedure for better understand

    CREATE PROC PRO2 @FirstName char(15)=NULL , @City char(15)=NULL
    WHERE FirstName LIKE ISNULL(@FirstName,FirstName)+’%’
    @City LIKE ‘%’+ISNULL(@City,City)+’%’
    EXEC PRO2 @FirstName=’h’,@City=’lt’

    even i do this query to assure its existence ‘sp_help pro2’ …… this works and shows me its contents …. i think there is a problem in schema but i cont understand this term clearly ……. plz help me out for this !

Leave a Reply

Your email address will not be published. Required fields are marked *