Right sort of thought, either the wrong function or wrong place.
So there are two ways to do it:
1: bindValue instead of bindParam
$stmt->bindValue(':keywords', '%'.$keywords.'%');
2: Correct $keywords.
$stmt->bindParam(':keywords', $keywords);
//...Other bits of code...
$keywords = "%".$keywords."%";
$stmt->execute();
bindParam works by REFERENCE - which means it doesnt matter what $keywords contains when you bind it, when you go to execute, PDO will check the value of $keywords at that time to determine what to put into your query. (Which is why bindParam works with loops - you can bindParam outside the loop, and just change the value of the variable inside the loop without needing to re-bind.
$stmt = $pdo->prepare("INSERT INTO mytable(keys) VALUES (:keywords)")
$stmt->bindParam(':keywords', $keywords);
foreach($myarray AS $keywords) {
$stmt->execute(); //Note that $keywords changes with each iteration of the loop because of FOREACH.
}