Msg 15151 Level 16 State 1 Line 1 Cannot find the user ‘username’ because it does not exist or you do not have permission.


Msg 15151, Level 16, State 1, Line 1
Cannot find the user ‘username’, because it does not exist or you do not have permission.

Example:
[sql]
GRANT EXECUTE ON OBJECT::dbo.test to username
[/sql]

Fix/resolution:

– Check if the user exists
[sql]
SELECT * FROM sys.server_principals WHERE name = N’username’
[/sql]
– Check if the stored procedure exists
[sql]
SELECT * FROM sys.procedures WHERE name = N’test’
[/sql]
– Make sure that the query is being executed in the database in which the stored procedure exists