IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_decision]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_decision]
GO
CREATE procedure [dbo].[mps_save_decision] 
@bd_id int,
 @bd_caption nvarchar(100),
 @bd_order int 
 as
begin
update mps_biztype_decision set 
bd_caption=case when @bd_caption='_none_' then bd_caption else @bd_caption end,
bd_order=case when @bd_order=-999999999 then bd_order else @bd_order end  
where bd_id=@bd_id
end