Your response pointed me in the right direction.
After looking at the object and verifying the permissions many times, I shifted my focus to the Login and User.
Apparently the login is mapped to a different user.
So when I checked the server_principal against the database_principal there was a mismatch.
The login is called appuser and i am also trying to grant permissions inside the database to appuser. Unfortunately someone created a different database user which is actually called appwebuser.
So once i discovered that we were granting permissions to the wrong user and update the code to the correct database user the problem was resolved.
I used the following query to track down the login. I add in the servername and dbname so i can check against my different environments and report to the customer.
SELECT
@@servername as [server_name]
,db_name() as [database_name]
,sp.name as [server_principal_name]
,sp.type as [server_principal_type]
,sp.type_desc as [server_principal_type_desc]
,sp.create_date as [server_principal_create_date]
,sp.default_database_name as [server_principal_default_database_name]
,dp.name as [database_principal_name]
,dp.type as [database_principal_type]
,dp.type_desc as [database_principal_type_desc]
,dp.default_schema_name as [database_principal_default_schema_name]
FROM
sys.database_principals dp INNER JOIN
sys.server_principals sp ON (dp.sid = sp.sid)
WHERE
sp.name like 'appuser'
or dp.name like 'appuser'
or sp.name like 'appwebuser'
or dp.name like 'appwebuser'
Best Answer
these are the standard permission:
for this mapped user settings:
you have in place some kind of deny for your users.