• Setting PrimaryObjects to false works for scripting permissions-only for tables, views and UDFs.

    However for sprocs it doesn't - the whole sproc is scripted with the permissions at the end.

    Your idea of filtering the piped output is fine - except when scripting directly to file.

    Am I misunderstanding what PrimaryObjects really means, or is this a bug?

    BTW for completeness there should be REVOKE on your list too 🙂