If I define a deterministic process $V(y,t)$ then by Taylor I have:
$$ V(0+\delta y, 0+\delta t) = V(y_0, t_0) + \frac{\partial V}{\partial y}|_0\delta y + + \frac{\partial V}{\partial t}|_0\delta t + \frac{1}{2} \left ( \frac{\partial^2 V}{\partial y \partial y}|_0\delta y^2 +2 \frac{\partial^2 V}{\partial y \partial t}|_0\delta t \delta y +\frac{\partial^2 V}{\partial t \partial t}|_0\delta t^2 \right ) $$ If $V(y_0, t_0)=0$ as are its derivatives at zero, except for $\frac{\partial^2 V}{\partial y \partial y} = g$ then this leaves for the process:
$$ V(y, t) = \frac{1}{2} g y^2 $$
Now if I were to suggest that at time, $T$, $y$ is a random variable, $Y \sim N (0, T \sigma^2 )$, then the expectation of $V$ is:
$$ \boxed{E[V(Y,T)] = \frac{1}{2}gE[Y^2] = \frac{1}{2}g T\sigma^2 }$$
I am stuggling to convert this into a stochastic formulation returning the same result.
Let $dY_t = \sigma dB_t$, then $Y_T \sim N(0, T \sigma^2) $ for Brownian motion B. Now, Ito's Lemma $$ dV_t = \frac{\partial V}{\partial y} dY_t + \frac{\partial V}{\partial t} dt + \frac{1}{2} g dt $$ If we assume $\frac{\partial V}{\partial t}$ is zero, and $\frac{\partial V}{\partial y}(t) = \int_0^t g(s) dY_s$ then the integral of this is, $$ V(T) = \int_0^T dV_t = \int_0^T \int_0^t g(s) dY_s dY_t + \int_0^T \frac{1}{2}g dt $$
When g is just a constant this results in,
$$ V(T) = \sigma ^2 g \int_0^T B_t dB_t + \frac{1}{2}gT = \sigma^2g\frac{1}{2}(B(T)^2 - T) + \frac{1}{2}gT $$ Which will not result in the same expectation, it out by factor of sigma squared, as above so something is wrong... ?
From scratch.
You assume $$ V(y,t)=\frac12g\,y^2 $$ where it seems that $g$ is a function of $t\,.$ Then for $Y_t=\sigma B_t\sim N(0,\sigma^2t)$ we clearly have your boxed equation $$ \mathbb E[V(Y_T,T)]=\frac12g(T)\,\sigma^2\,T\,. $$ Ito won't make any difference (except your life harder): \begin{align} V(Y_T,T)&=\underbrace{V(Y_0,0)}_{0}+\int_0^T\partial_tV(Y_s,s)\,ds+\int_0^T\partial_yV(Y_s,s)\,dY_s+\frac12\int_0^T\partial_{yy}V(Y_s,s)\,d\langle Y\rangle_s\\ &=\frac12\int_0^T\sigma^2 g'(s)\,B_s^2\,\,ds+\int_0^T\sigma^2 g(s)B_s\,dB_s+\frac12\int_0^T\sigma^2 g(s)\,ds\,. \end{align} Taking expectations the right hand side becomes \begin{align} \frac12\int_0^T\sigma^2 g'(s)\,s\,ds+\frac12\int_0^T\sigma^2 g(s)\,ds\,. \end{align} Using integration by parts on the first integral this is \begin{align}\require{cancel} \cancel{-\frac12\int_0^T\sigma^2 g(s)\,ds}+\frac12\sigma^2g(T)\,T+\cancel{\frac12\int_0^T\sigma^2 g(s)\,ds} \end{align} as it should.