Consider $f=x$ and $g=x^2$ as elements of $\mathbb R[x,y]$, which define the same curve, namely the $y$-axis.
According to the usual definition of a singular point (vanishing partial derivatives), it then seems to depend on the given polynomial whether a point on that curve is singular, although we are dealing with the same object. For $f$, all points are non-singular whereas they are all singular for $g$. I've also seen a definition that requires to consider the generators of the ideal of the curve, in this case it would be the ideal $(x)$ and therefore the curve non-singular. For me, this definition seems to be "more" correct because our curve doesn't look singular at any point. How do you handle this "problem"?
The difference here is whether you want to study the geometry of the zero locus of a polynomial, or the polynomial itself. The first case corresponds to "classical" algebraic geometry, which is the study of varieties and algebraic curves and so on, while the second belongs more to the theory of schemes.
Beginning with a set of points $S \subseteq \mathbb{R}^2$, we can ask various geometric questions about smoothness and dimension and so on. From the algebraic perspective, we want to represent $S = \{(0, y) \mid y \in \mathbb{R}\}$ as the zero locus of some collection of polynomials in $\mathbb{R}[x, y]$. As you've noticed, there are many ways of doing this, for example the polynomials $x$, $x^2$, $x(x^2 + 1)(y^2+1)$ all have the correct zero sets.
Here $(x)$ is the correct ideal to study for various reasons, which in this case basically boil down the the fact that $x$ cannot be factored. In general, you can define the ideal $$ I(S) = \{f \in \mathbb{R}[x, y] \mid f(s) = 0 \text{ for all } s \in S\}$$ and then find generators of the ideal. In our example, it can be shown that $I(S) = (x)$, and since the generator $x$ is irreducible, it will enjoy various nice properties, such as the fact that smoothness of $S$ will make sense in terms of the Jacobian of $f(x, y) = x$, and so on.
Classic algebraic geometry always puts sets of points through the $I$ function to get the "right" polynomials cutting out the set $S$, and then proves theorems about dimension and smoothness using the output of $I$. This stops silly equations like $x(x^2 + 1)(y^2 + 1)$ being used in place of the more simple $x$.
So that is one way of handling the "problem". The other is to use scheme theory, which regards the geometry cut out by $x = 0$ to be different to the geometry cut out by $x^2 = 0$. Schemes will notice that the difference between the intersection of two lines, and a line with a curve which is tangent at a point, since this is much like the difference between $x=0$ and $x^2 = 0$. However, the price you pay is that the theory is much more involved, and you need much more structure than a set of points sitting in a space.