When you use field attachment - Kentico saves Attachment GUID to the db as a value for this field .
For example if your field called MenuItemTeaserImage and you do tree.GetValue("MenuItemTeaserImage")
you should get GUID of the attachment
...
AttachmentInfo publishedAttachment = attachment as AttachmentInfo;
if (publishedAttachment != null)
{
if (tree.GetValue(AttachmentFieldName) == publishedAttachment.GUID) {
// you found fieldName attachment
}
}