Msg 2812, Level 16, State 62, Line 1 - Could not find stored procedure 'S'. - Issues with osql

If you are used to installing your SQL objects into the database server using scripts and osql command, you may sometime encounter this message

 Msg 2812, Level 16, State 62, Line 1
 Could not find stored procedure 'S'.

 

The error message will be the first letter in the name of the sp/object that is failing. I had this issue and was about to pull out my hairs when, after a lot of searching, I found the solution! It seems that osql doesn't take Unicode as input (unless explicitly specified by -u switch, but I could not confirm that from the documentation at https://technet.microsoft.com/en-us/library/aa213088(SQL.80).aspx ). To get around this, open the objects for which the installation is failing using a text editor, go to File>Save As and save with Encoding as ANSI.

Hope this helps someone out there lost with this bizarre issue.