Kindly see the below proof. This is from stackexchange. Here the author has shown that $C_{c}^{\infty}$ is a dense subset of $L^{1}(\mathbb{R})$".
I think the proof works well even for $L^{2}$. I have to put $| \;|^2$ (use $L^2$ norm) while doing the calculation for $\|g - g_\varepsilon \| < \frac{\epsilon}{2}$. Am I right ?
Link : Smooth functions with compact support are dense in $L^1$
We can ignore the information that $J_\varepsilon$ is a mollifier. All we need is a smooth function with integral one. $J_\varepsilon$ is such a function as proven in a) in the question above.
We will use that $C_c(X)$ is dense in $L^1$ to show that $C_c^\infty(X)$ is also dense in $L^1$ where $X$ is an open subset of $\mathbb{R}$. Let $\epsilon > 0$ and $f \in L^1$. Then by density of $C_c(X)$ there is a $g$ in $C_c(X)$ such that $\| f - g \|_{L^1} < \epsilon$.
Now we need to turn $g$ into a smooth function by convolving it with $J_\varepsilon$. Let $$g_\varepsilon (x) := (J_\varepsilon \ast g ) (x) = \int_\mathbb{R} J_\varepsilon(x - y) g(y) dy$$
Then $g_\varepsilon$ is smooth because $\left ( f \ast g \right )^\prime = f^\prime \ast g = f \ast g^\prime$ and $J_\varepsilon$ is infinitely differentiable.
$g_\varepsilon$ has compact support because if $[-S,S]$ is the support of $g$ and $[-R,R]$ is the support of $J_\varepsilon$ then the support of $J_\varepsilon \ast g$ is contained in $[-S - R, S + R]$ and hence is also compact.
To finish the proof we claim that $\| f - g_\varepsilon \|_{L^1} < \epsilon$:
$$ \| f - g_\varepsilon \| \leq \| f - g \| + \|g - g_\varepsilon \| < \epsilon$$
Where $\| f - g \| < \frac{\epsilon}{2}$ holds because $C_c(X)$ is dense in $L^1$ and $\|g - g_\varepsilon \| < \frac{\epsilon}{2}$ holds because:
$$\begin{align} \|g - g_\varepsilon \|_{L^1} = \int_X \left | g(z) - g_\varepsilon (z)\right | dz &= \int_X \left | g(z) - \int_\mathbb{R} J_\varepsilon(z -y) g(y) dy \right | dz \\ &= \int_X \left | g(z)\int_\mathbb{R}J_\varepsilon(y)dy - \int_\mathbb{R}J_\varepsilon(z -y) g(y) dy \right | dz\\ &\stackrel{(*)}{=} \int_X \left | g(z)\int_\mathbb{R}J_\varepsilon(z - y)dy - \int_\mathbb{R}J_\varepsilon(z -y) g(y) dy \right | dz \\ &= \int_X \left | \int_\mathbb{R} g(z) J_\varepsilon(z - y)dy - \int_\mathbb{R}J_\varepsilon(z -y) g(y) dy \right | dz \\ &\leq \int_X \int_\mathbb{R} | g(z) J_\varepsilon(z - y) |dy - \int_\mathbb{R} | J_\varepsilon(z -y) g(y) | dy dz \\ &= \int_X \int_\mathbb{R} |g(z) - g(y)| J_\varepsilon (z -y) dy dz \end{align}$$
Where the equality marked with (*) holds because the integral is over all of $\mathbb{R}$ so the shift by the constant $z$ doesn't change the integral and $J_\varepsilon$ is even hence $J_\varepsilon (y) = J_\varepsilon (-y)$.
$g$ is continuous and compactly supported hence it is uniformly continuous and so there exists a $\delta$ such that $|g(z) - g(y)| < \frac{\epsilon}{2 \lambda(X)}$ for all $z,y \in X$ hence by choosing $\varepsilon := \delta$ we get
$$ \int_X \int_\mathbb{R} |g(z) - g(y)| J_\delta (z -y) dy dz < \frac{\epsilon}{2} $$
Note that $\epsilon$ and $\varepsilon$ are not the same.