• If you wanted to avoid usiing extended stored prcedures you could do it like this. It's a bit more understandable than multiple nested select statements that are required for xp_execresultset to work properly...

     

    -- Specify the user account which should be

    DECLARE @login VARCHAR(50)

    SET @login = 'my_user_id'

     

    DECLARE @sql VARCHAR(max)

    Select

          @sql = Coalesce(@sql, '') + 'GRANT EXEC ON [' + [name] + '] TO [' + @login + ']' + Char(13)

    FROM sysobjects WHERE xtype = 'P' AND [name] NOT LIKE 'dt_%'

     

    EXEC (@sql)