Your XML has a namespace which you need to consider in your XPath expression.
You can extract the text you want without taking the namespace into account using this XPath expression:
//*[local-name()='AppMgmtDigest']/*[local-name()='Application']/*[local-name()='CustomId']
You can try:
select a.b.value('.','varchar(max)')
from @xml.nodes('//*[local-name()="AppMgmtDigest"]/*[local-name()="Application"]/*[local-name()="CustomId"]') a(b);
You can also register the namespace. You would probably have to add something like this before your select
query:
;with xmlnamespaces ('http://schemas.microsoft.com/SystemCenterConfigurationManager/2009/AppMgmtDigest' as prefix)
Where prefix
is any prefix you want. Then you use the prefix to qualify the XPath elements:
//prefix:AppMgmtDigest/prefix:Application/prefix:CustomId