--declare @packageNumber as int, @picture as image --set @packageNumber = 1 if exists (select 'x' from GCGBoxlineBoxLabelImage with (nolock) where PackageNumber = @packageNumber) begin update GCGBoxlineBoxLabelImage set Picture = @picture where PackageNumber = @packageNumber end else begin insert into GCGBoxlineBoxLabelImage (PackageNumber, Picture) values (@packageNumber, @picture) end