Drupal 6 - specific template if node contains specific form element
The relationship between nodes and webform components is maintained in the webform_component table so you should be able to get the data directly from there:

$sql = "
  SELECT COUNT(*) 
  FROM {webform_component} 
  WHERE nid = %d 
  AND value = '%s'
  AND type = 'hidden'";

$args = array($vars['node']-&gt;nid, $field_value);

$count = db_result(db_query($sql, $args));

if ($count &gt; 1) {
  // The webform has a hidden field with the correct value
}