• I would recommend reading this article that demonstrates how to iterate over the elements of an XML document. http://www.sqlservercentral.com/articles/XML/62290/%5B/url%5D

    The XQuery function "local-name()" can be used to find out the name of an element or attribute.

    .