Weierstrass' Theorem in Weighted Sobolev Spaces