Hi William Talada
I liked the script and has created a template to my need as
if db_name() not in ('payfknitfab','payfNova','payfd53_sql','payfa33_cont','payfjkt','payfgrmn_b26','payfgrmn_sql','payfNova_cont'
,'payho_sql','payfd53_cmpl','payfHO','payfd53_cont')
use payfknitfab
else if db_name() = 'payfknitfab' use payfNova
else if db_name() = 'payfNova'...