Put $x=\cos \theta$ then $dx = -\sin \theta d \theta = -(1-x^2)^{\frac 12}d \theta$. However, before doing this we must ensure that the substitution is $1-1$ , so we use the fact that $\cos$ is an even function, to write $\int_{- \frac \pi 2}^{\frac \pi 2} (\cos \theta)^n d \theta = 2\int_{0}^{\frac \pi 2} (\cos \theta)^n d \theta $. Therefore, we get :
$$
\int_{0}^{\frac \pi 2} (\cos \theta)^n d \theta = \int_0^1 x^n(1-x^2)^{- \frac 12} dx
$$
now put $y = x^2$, so that $dy = 2xdx $ so $dx = \frac{dy}{2 \sqrt y}$. Now we get :
$$
\int_0^1 x^n(1-x^2)^{- \frac 12} dx = \frac 12\int_0^1 y^{\frac n2} (1-y)^{- \frac 12} y^{- \frac 12}dy\\ =
\frac 12\int_0^1 y^{\frac {n+1}2 - 1} (1-y)^{- \frac 12}dy = \frac{\beta(\frac{n+1}{2},\frac 12)}{2}
$$
this $2$ cancels out with the $2$ we got from the even break up at the start, leading to the final answer being $$
\int_{- \frac \pi 2}^{\frac \pi 2} (\cos \theta)^n d \theta = \beta\left(\frac{n+1}{2},\frac 12\right)
$$
Your problem is solved by changing $n$ to $n-1$ in this argument. Also, since you have apparently attempted this approach but failed, it is possible that some of the steps need to be elaborated further, so kindly let me know.