This might be what you are looking for. It is available from plenty of places such as Google.
IF EXISTS (SELECT * FROM [dbo].[Table] WHERE [uid]=@uid) BEGIN
UPDATE [dbo].[Table] SET [Field1]=@Parameter1, [Field2]=@Parameter2 WHERE [uid]=@uid END
ELSE
BEGIN
INSERT INTO [dbo].[Table] ([Field1], [Field2])
VALUES (@Parameter1, @Parameter2) SET @uid=SCOPE_IDENTITY() END