Check if tag contains posts

You can use:

<?php if (get_tag('17')->count > 0) { ?>

<?php } ?>

get_tag is basically a get_term with taxonomy post_tag and get_term returns WP_Term object on success, WP_Error on error.

WP_Term has property $count which has object count for the term in process.