Loop inside of a loop. Don't show item from first loop if no posts in inside loop

So with the basics addressed in your separate post, the solution to hide the heading if there are no matching items in the loop looks like this:

<Loop type=taxonomy_term taxonomy=location_state>
  <If loop type=store taxonomy=location_state terms="{Field id}" taxonomy_2=rewards taxonomy_compare_2=exists terms_2="">
    <h2><Field title /></h2>
    <Loop type=store taxonomy=location_state terms="{Field id}" taxonomy_2=rewards taxonomy_compare_2=exists terms_2="">
        <a href="{Field url}"><Field title /></a>
    </Loop>
  </If>
</Loop>