Why are you using temp table and using subquery? A subquery is not as efficient as a join or a derived table or an exists. The latter being the most optimal. This would have been far more efficient in typing and execution.
You have allocated a data type varchar(50) for the database name when this should have been syname or nvarchar(128) as per the system tables that you are refering to. This would fail for database with a name > 50 characters
I would like to have had the date of the last backup if I'm checking.
SELECT @num_of_days = 7
WHEN b.DateLogLastBackedUp IS NULL THEN 1
END AS TransactionLogNeverBackedUpIndicator
( -- gets the latest available transaction log backup if exists
,MAX(backup_start_date) AS DateLogLastBackedUp
type = 'L' -- Log backups only
DATEDIFF(dd,backup_start_date,GETDATE()) > @num_of_days
b ON a.[name] = b.DateLogLastBackedUp
DATABASEPROPERTYEX(a.[name],'Recovery') = 'FULL'