The answer given in a textbook is
$dY=e^{aW}[t+\frac{1}{2}a^2W^2+2Wa]dt+ae^{aW}W^2dW$,
but mine is
$dY=e^{aW}[1+\frac{1}{2}a^2W^2+2aW]dt+e^{aW}(2W+aW^2)dW$.
Which is correct?
My solution:
$$\begin{aligned} dW^2 &= 2WdW+dt \\ de^{aW} &= e^{aW}(\frac{1}{2}a^2dt+adW) \\ (dW^2)(de^{aW}) &= e^{aW}2aW dt \\ dY &= W^2de^{aW}+e^{aW}dW^2+(dW^2)(de^{aW}) \end{aligned}$$
Your solution is correct. Ito's formula, applied to $$ f(x) = x^2 \exp(ax) $$ gives, as $$ f'(x) = (ax^2 + 2x)\exp(ax), \quad f''(x) = (a^2x^2 + 4ax + 2)\exp(ax), $$ that \begin{align*} dY = d\bigl(f(W_t)\bigr) = \frac 12(a^2 W_t^2 + 4aW_t + 2)\exp(aW_t) \,dt + (aW_t^2 + 2W_t)\exp(aW_t) \, dW_t \end{align*}