• The code below will do the trick with only one line of code:

    EXEC master..xp_execresultset

    N'SELECT ''GRANT EXEC ON '' + o.name + '' TO '' + ''my_user''

    FROM sysobjects o

    WHERE xtype = ''P'' AND [name] NOT LIKE ''dt_%'' ', my_db

    Just replace my_user and my_db with the correct values.

    I posted some more nice examples on xp_execresultset my blog some time ago:

    http://www.vandeputte.org/2005/10/xpexecresultset.html

    Kind regards,

    Frederik