in below example I changed page_verify_option_desc value to checksum value for all the databases, we can replace that with any
if exists (
select 1
from sys.databases
where page_verify_option_desc != ‘CHECKSUM’
and state_desc = ‘ONLINE’
)
begin
select ‘ALTER DATABASE ‘ + QUOTENAME(name) + ‘ SET PAGE_VERIFY CHECKSUM WITH NO_WAIT;’
from sys.databases
where page_verify_option_desc != ‘CHECKSUM’
and state_desc = ‘ONLINE’ and name not in (‘master’,’msdb’,’model’,’tempdb’)
end
else
select ‘ALL the databases has page_verify_option_desc as CHECKSUM’