MERGE [dbo].[Tenants] AS T
    USING (VALUES (@Id, @Name, @IsEnabled)) AS S([Id], [Name], [IsEnabled])
    ON T.[Id] = S.[Id]
    WHEN MATCHED THEN
UPDATE
    SET T.[Name] = S.[Name],
    T.[IsEnabled] = S.[IsEnabled]
    WHEN NOT MATCHED THEN
INSERT
(
[Id],
[Name],
[IsEnabled])
VALUES (S.[Id], S.[Name], S.[IsEnabled]);
