if exists(select 1 from sys.tables where object_id = object_id('dbo.BigTable')) drop table BigTable; --Drop SOURCEif exists(select 1 from sys.tables where object_id = object_id('dbo.RefTable ')) drop table RefTable; --Drop Lookup--Create a Source tableCREATE TABLE BigTable(software_name_raw VARCHAR(255))GO--Insert records into Source tableINSERT INTO BigTableVALUES('Microsoft Office 2003'),('Microsoft 2003 Office'),('Microsoft Office 2003 Professional'),('Sun Microsystems')GO--Create LOOKUP tableCREATE TABLE RefTable(software_name_raw VARCHAR(255) PRIMARY KEY,software_name_amended Varchar (255))GO--Insert records into Lookup tableINSERT INTO RefTableVALUES('Microsoft Office 2003', 'Office 2003'),('Microsoft 2003 Office', 'Office 2003'),('Microsoft Office 2003 Professional', 'Office 2003'),('Adobe', 'Adobe Inc')GOSELECT * FROM BigTable as Source_TABLESELECT * FROM RefTable as Lookup_TABLEGOinsert into RefTable(software_name_raw,software_name_amended)select bt.software_name_raw, 'Needs Updating'from BigTable btwhere not exists(select 1 from RefTable rf where rf.software_name_raw = bt.software_name_raw);select * from RefTable;update bt set software_name_raw = rt.software_name_amendedfrom BigTable bt inner join RefTable rt on (bt.software_name_raw = rt.software_name_raw)where rt.software_name_amended <> 'Needs Updating';select * from BigTable;GOif exists(select 1 from sys.tables where object_id = object_id('dbo.BigTable')) drop table BigTable; --Drop SOURCEif exists(select 1 from sys.tables where object_id = object_id('dbo.RefTable ')) drop table RefTable; --Drop LookupGO