IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[mps_save_codemanage]') AND type = 'P')
DROP PROCEDURE [dbo].[mps_save_codemanage]
GO
CREATE procedure [dbo].[mps_save_codemanage] 
@bmid int,
@bm_text nvarchar(200),
@bm_order int  as
begin
     update mps_code set bm_text= case when @bm_text='_none_' then bm_text else @bm_text end,
     bm_order = case when @bm_order=-999999999 then bm_order else @bm_order end
     where bm_id=@bmid
end