CREATE PROCEDURE [dbo].[blAddProduct]
   @ProdId AS INT, @ErpId AS INT, @Price decimal(16,4) , @Stock decimal(16,4)
AS 
BEGIN
update [dbo].[blProducts] set [ErpItemId] = @ErpId , Price = @Price, Stock = @Stock	
where [BlProdId] = @ProdId;

IF @@ROWCOUNT = 0
BEGIN
INSERT INTO [dbo].[blProducts]
           ([BlProdId],[ErpItemId],[Price],Stock)
     VALUES
           (@ProdId,@ErpId, @Price, @Stock);
End

End