Solution (source code)

= Solution

Set $\theta=(\mu-r)/\sigma$. The positive density
$$
Z_T=\exp\left(-\theta W_T-\frac12\theta^2T\right)
$$
has mean one, and the <Girsanov theorem> makes $W_t^Q=W_t+\theta t$ a <Brownian motion> under the equivalent measure $Q$. Hence
$$
dS_t=S_t(r\,dt+\sigma\,dW_t^Q).
$$
The <Black-Scholes equation> makes $e^{-rt}V(t,S_t)$ a local martingale. Bounded $V$ on the finite horizon makes it a true martingale, so its terminal condition gives the <risk-neutral valuation>
$$
V(t,S_t)=e^{-r(T-t)}\mathbb E_Q[g(S_T)\mid\mathcal F_t].
$$
The <geometric Brownian motion> solution under $Q$ is
$$
S_T=S_t\exp\left((r-\tfrac12\sigma^2)(T-t)+\sigma(W_T^Q-W_t^Q)\right).
$$
The Brownian increment is independent of $\mathcal F_t$ and equals $\sqrt{T-t}\,Z$ in distribution, where $Z$ has the <standard normal distribution>. Therefore
$$
\boxed{V(t,s)=e^{-r(T-t)}\mathbb E\left[g\left(se^{a(t)+b(t)Z}\right)\right],\qquad
a(t)=(r-\tfrac12\sigma^2)(T-t),\quad b(t)=\sigma\sqrt{T-t}.}
$$
The expectation on the right is only an integral against the standard normal law; the physical drift $\mu$ has disappeared.