Is there are way to grant Execute permission to a particular Stored procedure or Function in all database of SQL Server 2008 Instance?
The below one use to Grant Execute permission to any procedure.
EXEC sp_msforeachdb 'USE ?; GRANT EXECUTE TO UserOrRoleName'
But when trying the below one I'm getting error
EXEC sp_msforeachdb 'USE ?; GRANT EXECUTE ON [?].[dbo].[sp_StoredProc1] TO UserOrRoleName' Error Message: Cannot find the object 'sp_StoredProc1', because it does not exist or you do not have permission.
I have the 'sp_StroedProc1' exist in all my database in the sql server 2008 instance. Any help will be highly appreciated.