What you need an output of an sql query to xml.if so you can use the below code.
using (System.Data.SqlClient.SqlConnection c = new SqlConnection(ConfigurationManager.ConnectionStrings["connectionstringname"].ConnectionString))
using (System.Data.SqlClient.SqlCommand cmd = c.CreateCommand())
{
cmd.CommandText = "yourstoredprocedure";
cmd.CommandType = CommandType.StoredProcedure;
c.Open();
System.Xml.XmlReader r = cmd.ExecuteXmlReader();
XmlDocument document = new XmlDocument();
document.Load(r);
Response.ContentType = "text/xml";
document.Save(Response.Output);
c.Close();
}
}