What is the canonical way to do a database "upsert" using scripting?

Looks like the closest equivalent for SQL Server is the MERGE statement. SQL Server 2019 does not support the standard’s ON CONFLICT clause.