I prefer to use "Number" (one-based) so that I can distinguish it from "WholeNumber" which is zero-based. The column name I used for both tables is "value".
Use the XmlBulkLoader from the SqlXml3.0 to load your data into temp table, compare and use FOR XML AUTO|EXPLICIT|RAW to return the result back out as xml.