Could not find stored procedure 'sp_executeSQL'.
SQL developers may experience Could not find stored procedure 'sp_executeSQL'. error when executing sp_executeSQL procedure on a SQL Server database with case sensitive collation. If the SQL command is written not exactly as the database objects created, such error will happen frequently on case sentitive collation SQL databases.
Here is the case I first time experienced the SQL error when I execute a very simple SQL command:
Msg 2812, Level 16, State 62, Line 5
Could not find stored procedure 'sp_executeSQL'.
And when I check the database collation using following SQL statement, I see that the database is created with a case sensitive collation.
I can see that the database collation is configured as "Turkish_CS_AS" Turkish Case Sensitive, Accent Sensitive which is causing the SQL Engine to throw error related with not found sp_executeSQL system stored procedure.
Fortunately, although the error is odd, the correction is simple. Just write the SQL codes for the database object names in the correct case as they are created.
For example, instead of using sp_executeSQL, code using sp_executesql which will be successfully executed.