• I have to agree with David.

    The simplest way to generate KML from SQL Server data is to serve it up using an xml template with an XSLT file.

    The idea of embedding elements in an sproc fills me with dread.