Here is a simple script to mimic your environment as I have understood it.CREATE TABLE #Sample ( theDate DATE PRIMARY KEY CLUSTERED, totalDATA XML COLUMN_SET FOR ALL_SPARSE_COLUMNS NULL, ColumnName1 VARCHAR(40) SPARSE NULL )-- Read the first fileDECLARE @Data XML = '<ColumnName1>Peso</ColumnName1>'-- Insert into target tableINSERT #Sample ( theDate, totalDATA )VALUES ('20110101', @Data)-- Show the content of current tableSELECT thedate, totalData, ColumnName1FROM #Sample-- Now add new columns present in another fileALTER TABLE #SampleADD ColumnName2 VARCHAR(40) SPARSE NULL, ColumnName3 VARCHAR(40) SPARSE NULL-- Add content from the new file with new columnsMERGE #Sample AS tgtUSING ( SELECT '20110101' AS theDate, '<ColumnName1>Peso</ColumnName1><ColumnName3>MVP</ColumnName3>' AS totalDATA UNION ALL SELECT '20110201', '<ColumnName2>SQLTeam</ColumnName2>' ) AS src ON src.theDate = tgt.theDateWHEN MATCHED THEN UPDATE SET tgt.totalData = src.totalDataWHEN NOT MATCHED BY TARGET THEN INSERT ( theDate, totalDATA ) VALUES ( src.theDate, src.totalDATA );-- Display the content of current tableSELECT theDate, totalDATA, ColumnName1, ColumnName2, ColumnName3FROM #SampleDROP TABLE #SamplePlease note, that when referencing the SPARSE columns, you cannot use "*". You have to explicit name all columns you want to retrieve later.SPARSE columns let you have about 32767 columns in a table.
N 56°04'39.26"E 12°55'05.63"