Let's say I have a function that is accessed in many stored procedures. If that function has no entries in sys.database_permissions
does any account that can run one of the stored procs automatically run the function?
This is the query I'm using:
exec sp_depends 'dbo.theFunction'
-- for each object in those results, run this query
select *
from sys.database_permissions dp
where
grantee_principal_id=USER_ID('theAccount')
and
major_id=object_id('dbo.theFunction')
and minor_id=0
and ( state_desc = 'GRANT' or state_desc = 'SELECT' )