Let $M$ be the finitely generated module, and $M_{tor}$ its torsion submodule.
As part of the proof of the structure theorem, one shows that $M/M_{tor}$ is free
of finite rank, and that $M$ is isomorphic to $M_{tor} \oplus M/M_{tor}$,
so it suffices to show uniqueness for free modules and torsion modules separately.
For a free module, its free rank can be computed as the maximal number of linearly independent
elements (just using the usual linear algebra definition, but applied to the free module).
So the free rank of $M/M_{tor}$ is uniquely determined. (In fact, one can apply this
directly to $M$ --- the free part of $M$ in the decomposition given by the structure theorem
is just the maximal number of linearly independent elements of $M$ --- and so you
don't need to explicitly consider $M/M_{tor}$ if you don't want to.)
We are now reduced to the case when $M = M_{tor}$, i.e. $M$ is torsion. The structure theorem then gives us that $M$ is a direct sum of modules of the
form $A/\wp_j^{i_j} A$ for various non-zero prime ideals $\wp_j$ of $A$, and various indices $i_j$.
Imagine now that we have another such decomposition, into a direct sum of $A/\wp ' {} _j^{i'_j}.$
If we fix a non-zero prime ideal $\wp$ of $M$, and some $n \geq 0,$
then let $M[\wp^n]$ denote the submodule of $M$ consisting of elements annihilated by
$\wp^n$. A direct computation with each of the decompositions in turn shows that
$M[\wp^n]/M[\wp^{n-1}]$ is an $A/\wp$-vector space of dimension equal to the number
of $j$ for which $\wp_j = \wp$ and $i_j \geq n,$ and also equal to the number of
$j$ for which $\wp'_j = \wp$ and $i'_j \geq n.$ Since $\wp$ and $n$ were arbitrary,
this shows that the two decompositions coincide.
One can also make the following variant of this argument, in which we break it into two steps.
Namely, first fix a non-zero prime ideal of $A$, and consider $M[\wp^n]$. If $n$ is larger than
any of the $i_j$ or $i'_j$, then this is the direct sum of just those $A/\wp_j^{i_j}$
for which $\wp_j = \wp$, and also is the direct sum of just those
$A/\wp' {} _j^{i'_j}$ for which $\wp'_j = \wp$.
Thus, replacing $M$ by $M[\wp^n]$ as $\wp$ runs over all the $\wp_j$ and $\wp'_j$, we may assume that all the $\wp_j$ and $\wp'_j$ coincide with some fixed prime ideal $\wp$.
We can then repeat the above argument, but just varying $n$, and keeping $\wp$ equal
to our given choice of prime ideal.
There is also the following variant, using quotients, rather than subobjects, namely,
fix a non-zero prime ideal of $A$, and consider $M/\wp^n M$. Again, if $n$ is larger than
any of the $i_j$ or $i_j'$, then this is the direct sum of just those $A/\wp_j^{i_j}$
for which $\wp_j = \wp$, and also is the direct sum of just those
$A/\wp' {} _j^{i'_j}$ for which $\wp'_j = \wp$.
At this point, we could consider submodules of prescribed torsion, as above,
but, since we have started by using quotients, we can finish by using quotients as well,
by considering the quotients of the form $\wp^n M/\wp^{n+1}M$ just as in
Pierre-Yves Gaillard's comment above. As he explains, this also gives the desired uniqueness.