Try like that
CREATE PROC AlterSomeObj
@act VARCHAR(10) = 'C',
@objXML xml
AS
IF (@act = 'C') -- for creating
BEGIN
INSERT Table1(val1, val2)
SELECT
ITEM.TAB.value('val1[1]','VARCHAR(1000)') AS val1 ,
ITEM.TAB.value('val2[1]','VARCHAR(MAX)') AS val2 ,
FROM @objXML.nodes('ParentNode/ChildNode') ITEM(TAB)
END
ELSE IF(@act = 'U') -- for updating
BEGIN
U Table1
SET
val1 = TAB.val1 ,
val2 = TAB.val2,
FROM
Table1 ITEMITEMS
INNER JOIN
(
SELECT
ITEM.TAB.value('val1[1]','VARCHAR(1000)') AS val1 ,
ITEM.TAB.value('val2[1]','VARCHAR(MAX)') AS val2
FROM @objXML.nodes('ParentNode/ChildNode') ITEM(TAB)
)TAB
ON ITEMITEMS.ID = @urlID
END
ELSE IF(@act = 'D') -- for deleting
BEGIN
--delete logic
END
As I think it will solve your problem