Example of two prime ideals whose intersection of the squares not equal to the square of the intersection
Solution 1:
What about the following: Let $R$ be the ring $k[x,y]/(x^2y-y^2x)$. Let us take $\mathfrak p=(x)$ and $\mathfrak q=(y)$. These are prime ideals. Furthermore $\mathfrak p\cap \mathfrak q=(xy)$, so $(\mathfrak p\cap \mathfrak q)^2=(x^2y^2)$. But, $x^2y=y^2x\in \mathfrak p^2\cap \mathfrak q^2.$
Edit. The same idea works for integral domains. Let $R=k[x,y,u,v]/(x^2y-u^2v)$. Then take $\mathfrak p=(x,v)$ and $\mathfrak q=(y,u)$, these are prime ideals. Then $\mathfrak p\cap \mathfrak q=(xy,xu,vy,vu)$, so $(\mathfrak p\cap \mathfrak q)^2$ is generated by elements of degree $4$. But $x^2y=u^2v$ is in $\mathfrak p^2\cap \mathfrak q^2$.
Solution 2:
How about $R=k[x,y,u,v]/(xy-uv)$. Let $I=(x,y)$, $J=(u,v)$. Clearly $xy=uv\in I^2\cap J^2$, but $xy\notin (I\cap J)^2$.
Edit. Let $R=k[x,y,u,v,a,b,c,d]/(xy+uv-ab-cd)$, $\mathfrak p=(x,y,u,v)$, $\mathfrak q=(a,b,c,d)$. Clearly $t:=xy+uv=ab+cd\in\mathfrak p^2\cap\mathfrak q^2$, but $t\notin (\mathfrak p\cap\mathfrak q)^2$.