The idea is to choose your variables wisely: choose variables according to the entities mentioned in the wording. Then translate word by word to equations. After that stop thinking and start running your algorithm you learned for solving these equations.
Another approach would be with three variables, where the terms are closer to the original phrasing and where you need to "think" less but "calculate" more. Generaly fact: if a person is born in year $b$, then in some other year $a$ the person is aged $a - b$.
Let $X$ and $Y$ be the years of birth of Xaver and Yvonne respectively. And let $N$ be the year now.
The we have: Yvonne is 12 now:
$$
N - Y = 12
\Leftrightarrow Y = N - 12
$$
The year "when Xavier was as old as Yvonne is now" is
$$
X + 12
$$
In this year, Yvonne was
$$
(X + 12) - Y
$$
"Now, Xavier is twice as old as Yvonne was back then"
$$
N - X = 2 \cdot ( X + 12 - Y)
$$
And from this position on, we only need to calculate:
$$
N -X = 2\cdot X + 24 - 2\cdot Y
$$
Resolving this for the birth year of Xaver:
$$3\cdot X
= 24 - 2\cdot Y - N
= 24 - 2\cdot (N - 12) - N
\\
= 24 - 2\cdot N + 24 -N
= 48 - 3\cdot N
\\
\Leftrightarrow X = 16 - N
\\
\Leftrightarrow N - X = 16
$$
So Xaver is indeed 16.
Though shorter solutions were posted already, I hope you can see the translation quite clear here.