declare @xml xml='<root><element>1</element><element>2</element></root>'declare @n int=2SET @xml.modify('replace value of (//root/element[position()=sql:variable("@n")]/text())[1] with "12"')select @xml