Security Permission Differences Between Databases - SQL Server

The following SQL statement will list the security permission differences between two databases.

    case type
        when 'C'  then 'check constraint'
        when 'D'  then 'default'
        when 'F'  then 'foreign key'
        when 'FN' then 'function'
        when 'K'  then 'primary key'
        when 'P'  then 'stored procedure'
        when 'S'  then 'system table'
        when 'TF' then 'table function'
        when 'TR' then 'trigger'
        when 'U'  then 'user table'
        when 'V'  then 'view'
        else type
    end as type,
    DevDb.dbo.sysobjects odev
    inner join DevDb.dbo.sysprotects pdev
        on =
    inner join DevDb.dbo.sysusers udev
        on udev.uid = pdev.uid
where 1=1
    and = 'public'
    and pdev.protecttype in (204,205)
    and not in
        (select distinct 
            ProdDb.dbo.sysobjects oprod
            inner join ProdDb.dbo.sysprotects pprod
                on =
            inner join ProdDb.dbo.sysusers uprod
                on uprod.uid = pprod.uid
        where 1=1
            and = 'public'
            and pprod.protecttype in (204,205)
order by