I’m not familiar with MSSQL, but with other databases, I would suggest attempting to insert the new record (assuming there is a unique key to prevent duplicate records) and then either catch (if I cared) or ignore (if I don’t care) the duplicate key exception and then issue the UPDATE; or attempt the update, check the number of rows affected, and if it was zero, run the insert.