Add the below given code in to your functions.php
global $wpdb;
$templateQry = “select meta_key from $wpdb->postmeta where meta_key like ‘_wp_page_template’ and meta_value like ‘Template1′”;
$result = $wpdb->query($templateQry);
if ($result) {
echo “page Template1 is active”
} else {
echo “page Template1 is not active”
}