An answer to this question was given to me by Pierre Schapira. This is known as the microlocal Bertini-Sard theorem (cf. Sheaves on manifolds cor. 8.3.12).
Consider a map $f:X\to A^1$. It induces $f_\pi : X\times_{A^1} T^*A^1 \to T^*A^1$ and $f_d : X\times_{A^1} T^*A^1 \to T^*X$. Set $\Lambda = SS(M)$ the characteristic variety of $M$. This is a closed conic isotropic subset of $T^*X$. Now $$ supp(\phi_{f-t}(M)) \subset [ x ~|~ f(x) = t,~(x,df(x)) \in \Lambda ] $$ so $$ [ t\in A^1 ~|~ \phi_{f-\lambda}(M) \neq 0 ] \subset [ t\in A^1 ~|~ (t,dt)\in f_\pi f_d^{-1}(\Lambda) ] $$
Now assume that $f$ is compactifiable as $X\overset{j}{\to} \bar{X} \overset{\bar{f}}{\to} A^1$, $j$ an open immersion and $\bar{f}$ proper. The closure $\bar{\Lambda}$ of $\Lambda$ is $T^*\bar{X}$ is a closed conic isotropic subset and since $\bar{f}$ is proper, $\bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})$ is a closed conic isotropic subset of $T^*A^1$. So its intersection with the nowhere vanishing section
$$ [t \in A^1 ~|~ (t,dt) \in \bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})] $$
has dimension 0. Since $f_\pi f_d^{-1}(\Lambda) \subset \bar{f}_\pi \bar{f}_d^{-1}(\bar{\Lambda})$ the same is true for
$$ [ t\in A^1 ~|~ \phi_{f-\lambda}(M) \neq 0 ] \subset [ t\in A^1 ~|~ (t,dt)\in f_\pi f_d^{-1}(\Lambda) ] $$
and the theorem is proved.
If $f$ is algebraic it is always compactifiable. If $f$ is analytic, I don't know if the theorem still holds in general.
PS: If $f(x) = \lambda $, the condition $(x,df(x)) \in T^*Z T^*_Z X$ just says that the fiber ${f \{f = \lambda}$ lambda\}$ is tranverse to $Z$ at $x$. So when $SS(M) \subset \bigcup T^*{S_\alpha} T^*_{S_\alpha} X$ this gives the geometric interpretation that the vanishing cycles are 0 whenever the fibers are transverse to the strata.

