Cannot find the object "XXX" because it does not exist or you do not have permission

I discovered that I had left off the "GO" word after "END" in my stored proc. Altering the Proc and adding back GO fixed this issue for me.


Ok, here's what happened. There was a special character before the end of the SP so it was incomplete yet still valid, somehow.

So I could see the SP and see the permissions on it but I could not run it. So to solve the issue I had to copy the text out of SQL Management Studio and paste it into Notepad, then remove the special character, then copy and paste it back into SQL Management Studio and run the alter script.

Very strange how the character got there!


I meet this issue too. In my case, I granted execution permission just after creating stored procedure. And there is no 'GO' between the two statements. I added GO, and it works.