I want to prove a result on equivalences of quadratic forms over $\mathbb{Q}_p$, with a control on the height of the change-of-basis matrix. (I am more generally interested in hermitian forms over division algebras over local fields, but for the purposes of this question the simplest case seems the most awkward.) I need the following result, which I can prove in a tedious way:

Let $p$ be a prime not equal to $2$ and $M \in \mathrm{M}_n(\mathbb{Z}_p)$. If there exists $A \in \mathrm{M}_n(\mathbb{Q}_p)$ such that $M = AA^t$ then there exists $B \in \mathrm{M}_n(\mathbb{Z}_p)$ such that $M = BB^t$.

(The difference between $A$ and $B$ is that $B$ has integer entries, while $A$ might not.)

I can prove this as follows: the quadratic form represented by $M$ can be diagonalised over $\mathbb{Z}_p$, so we may assume that $M$ is diagonal. We can also assume that its diagonal entries are contained in $\{ 1, p, u, pu \}$ for some fixed non-square unit $u$.

Since $M = AA^t$ this quadratic form is equivalent to the standard one over $\mathbb{Q}_p$. Thus $\det M$ is a square and it has Hasse invariant $+1$. This translates into conditions mod 4 on how many times $p$, $u$ and $pu$ appear (the conditions are different depending on whether $p$ is 1 or 3 mod 4). Thus there is a finite list of matrices of size at most 4 which have to be checked, and for each of these you can exhibit explicitly a suitable $B$.

Going through this list is quite tedious. Is there a more elegant proof of the result, or has it been written down somewhere already?