T-SQL sp_msforeachdb problem
? stands for the datbase name and sys.dm_database_encryption_keys holds database_id.

exec master..sp_msforeachdb
'
IF NOT EXISTS 
(
    SELECT  null
    FROM    [?].sys.dm_database_encryption_keys 
    WHERE   database_id = db_id(''?'')
)
BEGIN
    print ''?''
END
'