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