What if your boss wants you to insert or updated a record in a table in several servers? lets say 50 server what would you do? Open each and every servers and run the insert or update? that will take time if you have several servers. Let this script do the job for you..... All you have to do is to linked that server to the server where you will run the script,create this procedure, run this script and whalaaaaa done....
NOTE: for you to use this script first modify the query by changing single quotes with double quotes
If your query is
select name from master..sysdatabases where name = 'master'
when applying it to the script it must be
select name form master..sysdatabase where name = ''master''
example query :
syntax usp_linked_query 'db_name','db_owner','query'
operation: usp_linked_query 'master','dbo','select name from sysdatabases where name = ''master'''
update example
usp_linked_query 'db_name','db_owner','update table_name set col_name = ''value'' where condition'
*Always change single quotes to double quotes and enclose the whole query with ' '