Q:

selecting multiple rows and columns over a xml variable

Usually I use a XML variable in filters, because they are easy to work.
Considering tablea, where column1 is the primary key:
declare @xml xml = '<column1>1</column1><column1>2</column1>'

select *
from tablea
where
    column1 in (select x.i.value('.', 'bigint') from @xml.nodes('/column1') x(i)) or
    @xml is null

It works because the select over the xml returns two rows, with values 1 and 2.
Now I have a tableb, with a composite primary key, column1 and column2. So:
declare @xml xml = '<row><column1>1</column1><column2>2</column2></row><row><column1>3</column1><column2>4</column2></row>'

How can I write a select over the xml to return each row and columns, like:
column1 column2
1       2
3       4

A:

declare @xml xml = '<row><column1 a="a">1</column1><column2>2</column2></row><row>' +
    '<column1>3</column1><column2>4</column2></row>'

select  col.value('data(column1[1])', 'int') as column1
,       col.value('data(column2[1])', 'int') as column2
from    @xml.nodes('/row') tbl(col)

Example at SQL Fiddle.

