term_variable_occurrences/2

"term_variable_occurrences(? Term, - Variables" )

Unify Variables the list of all occurrence of variables in term Term.