Table based on column is null then Inserted, other wise updated how to put condition for insert and update using one Procedure

When one table Flag column is Null then Inserted, other wise not null it will updated, how to Put condition Before Insert and update Procedure, Please Suggest me Proper solution.