I have a SQL script to select and collect some info into temp table and populate data, And now I have a scenario where the table columns are different for different app versions and we use linked server to execute the script to multiple sql instances. so, it fails for specific sql instances with the latest application version which does not have that column.
Any idea on how to update the script to run for, i.e., if it is v1 it the stored procedure should run for that version and for V2 it should run the same procedure but the different script.
For ex: I want this script to run for V1 and I want line 2 for v2 in the same procedure
CREATE PROCEDURE [dbo].[sp_BoardServerTotals]
DELETE FROM BoardServer_Report - v1
DELETE FROM BoardServer - v2