Let's say I have the code USE DB1AGOCREATE FUNCTION Function1 [...]GOCREATE SPROC sp_Sproc1 (@1ColumnName, @2ColumnName) ASEXEC('SELECT * FROM DB1A.Table1 INNER JOIN DB2A.Table1 on DB1A.Table1.' + @1ColumnName + ' =Function1(DB2A.Table1.' + @2ColumnName + ')')GOEXEC DB1A.sp_Sproc1 (Column1, Column1)GOEXEC DB1A.sp_Sproc1 (Column2, Column2)GONow, if someone else had the same databases as me, except they were named DB1 and DB12, they could run a find-and-replace to Fix up my code for their use. But what if they wanted a variable that could change what the database name was at the top?Making DB1A a variable is easy:DECLARE @FirstDB varchar(200);SET @FirstDB = 'DB1A';EXEC ('USE ' + @DB);GOThen, just delete all future references to DB1A. But how would I set @SecondDB and pass it over a GO statement to run in a batch?I can't even make it all a big sproc with terms sp_MaserSproc(@FirstDB, @SecondDB) because of all of the GO statements...right? Or can I?Thanks,Arithmomaniac---------Ignorance may be bliss, but knowledge is thrill.