you can use following way
$attachment_id = 5; //put here you attachment id
$sql = "SELECT count(DISTINCT pm.post_id) FROM $wpdb->postmeta pm JOIN $wpdb->posts p ON (p.ID = pm.post_id) WHERE pm.meta_key = '_thumbnail_id' AND pm.meta_value="$attachment_id" AND p.post_type="post" AND p.post_status="publish"";
$count = $wpdb->get_var($sql);