DECLARE @databasename VARCHAR(50) -- database name
DECLARE @sql VARCHAR(Max)

DECLARE db_cursor CURSOR READ_ONLY FOR
SELECT name
FROM master.sys.databases
WHERE name NOT IN ('master','model','msdb','tempdb') -- exclude these databases
AND state = 0 -- database is online
AND is_in_standby = 0 -- database is not read only for log shipping

OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @databasename

WHILE @@FETCH_STATUS = 0
BEGIN

set @sql = 'alter database ['+ @databasename + '] set recovery simple;'

print @sql

--exec @sql

FETCH NEXT FROM db_cursor INTO @databasename
END


CLOSE db_cursor
DEALLOCATE db_cursor