I have a query as below
IF EXISTS( SELECT * from @dbname.dbo.tbl1)
BEGIN
...
END
ELSE
BEGIN
...
END
Also The code in begin and end part for both if and else is large enough to use as a string for dynamic query. How can I achieve this?